//
//  FPFilmcriticView.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/14.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPFilmcriticView.h"
#import "FPVisualEffectView.h"
@implementation FPFilmcriticView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        //添加大图
        self.centreImageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kImageH(150))];
        self.centreImageView.image = [UIImage imageNamed:@"4.jpg"];
        [self addSubview:_centreImageView];
        
        //添加
        self.labelView = [[UILabel alloc]initWithFrame:CGRectMake(0, kImageH(100), kScreenWidth, kImageH(50))];
        self.labelView.backgroundColor = [UIColor redColor];
        [self addSubview:_labelView];
        
        self.leftDownPic = [[UIImageView alloc]initWithFrame:CGRectMake(kImageW(10), kImageH(75), kImageW(50), kImageH(75))];
        self.leftDownPic.backgroundColor = [UIColor greenColor];
        [self addSubview:_leftDownPic];
        self.filmNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(kImageW(85), kImageH(100), kScreenWidth - kImageW(85), kImageH(30))];
        self.filmNameLabel.textColor = [UIColor whiteColor];

        self.filmNameLabel.text = @"hello World";
        [self addSubview:_filmNameLabel];

        self.introLabel = [[UILabel alloc]initWithFrame:CGRectMake(kImageW(85), kImageH(130), kScreenWidth - kImageW(85), kImageH(20))];
        self.introLabel.textColor = [UIColor whiteColor];
        self.introLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:_introLabel];
   
    }
    return self;
}

- (void)viewSetValue:(FPFilmHeaderModel *)model
{
   
    //创建一个imageView
    UIImageView *backImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kImageH(50))];
    [backImage sd_setImageWithURL:[NSURL URLWithString:model.imageUrl]];
    //打开交互
    backImage.userInteractionEnabled = YES;
    //创建模糊效果视图
    UIVisualEffectView *visualEffect = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
    //设置visual的frame 和 backImage的frame一样
    visualEffect.frame = backImage.bounds;
    visualEffect.alpha = 1;
    [backImage addSubview:visualEffect];
    [self.labelView addSubview:backImage];
    [self.centreImageView sd_setImageWithURL:[NSURL URLWithString:model.imageUrl] placeholderImage:nil completed:nil];
    [self.leftDownPic sd_setImageWithURL:[NSURL URLWithString:model.posterUrl]];
    self.introLabel.text = model.title;
    self.filmNameLabel.text = model.movieName;
}
@end
